import { useEffect } from 'react';
import store from '../store';

const hide = (payload = {}) => {
  return { type: 'hide-tabbar', payload };
};

const show = (payload = {}) => {
  return { type: 'show-tabbar', payload };
};

const useAutoHandleTabbar = () => {
  useEffect(() => {
    store.dispatch(hide());
    return () => {
      store.dispatch(show());
    };
  }, []);
};

export { hide, show, useAutoHandleTabbar };
